﻿<html>
<head><title>JavaScript对象创建</title></head>
<script>
	var myName = function(){
		for (var name in this.global) {           
			if (this.global[name] === this) {
				return name;
			}
		}
	}
	function Person() {
		this.myName = myName;
	}
	Person.prototype.global = this;
	var nick = new Person();
	console.log(nick.myName());
</script>
</html>
